﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<!-- 包含公共的JSP代码片段 -->
	
<title>餐馆王平台</title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="${ctx}/front/detail/style/js/jquery.js"></script>
<script type="text/javascript" src="${ctx}/front/detail/style/js/page_common.js"></script>
<link href="${ctx}/front/detail/style/css/common_style_blue.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="${ctx}/front/detail/style/css/index_1.css" />
<link href="${ctx}/front/detail/style/css/index.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="${ctx}/front/detail/style/css/dis_message.css" />
	<script type="application/javascript">
		function takeInToCart(foodId){
			$.ajax({
				"url":"${ctx}/front/data",
				"data":{"foodId":foodId,"method":"takeInToCart"},
				"type":"POST",
				"dataType":"json",
				"success":function(data){
					console.log(data)
					if(data && !data.success){
						alert(data.message);
						if(data.message=="您还未登录，请先登录！"){
							if(confirm("要去登录吗？"))
							{
								location.href = "${ctx}/login.jsp";
							}
						}else if(data.message=="您有订单还没结账，请先去结账！"){
							location.href = "data?method=getOrderList&orderId="+data.data;
						}
					}else if(data && data.success){
						location.href = "data?method=getCart"
					}
				}
			});
		}
	</script>
</head>
<body style="text-align: center">
	<div id="all">
		<!--左边菜品详细信息 -->
		<div id="menu1">
			<div class="menu2" style="text-align:center;">
				<img src="${ctx}/front/detail/style/images/order_detials_bg.png" />
			</div>
			<div class="menu3">
				<div class="menu3_left">
					<img src="${ctx}${foodDetail.foodImage}"
						style="width:270px; height:290px;" />
				</div>
				<div class="menu3_right">
					<p>菜名:${foodDetail.foodName}</p>
					<p>价格:&nbsp;&nbsp;&yen;&nbsp;${foodDetail.price}</p>
					<p>会员价:&nbsp;&nbsp;&yen;&nbsp;${foodDetail.vipPrice}</p>
					<p>简介:${foodDetail.foodDesc}</p>
				</div>
			</div>
			<div class="menu4">
				<a href="javascript:void(0)" onclick="takeInToCart(${foodDetail.foodId})"
				   style="background:url(${ctx}/front/detail/style/images/img/order_left_corner_bg.png);">放入餐车</a>
				<a href="#" onclick="javascript:history.go(-1);" style="background:url(${ctx}/front/detail/style/images/img/order_right_corner_bg.png);">返回</a>
			</div>
		</div>
		
		<!-- 右边菜系列表，菜品搜索框  -->
		<div id="dish_class">
			<div id="dish_top">
				<ul>
					<li class="dish_num"></li>
					<li>
						<a href="${ctx}/front/data?method=getCart">
							<img src="${ctx}/front/detail/style/images/call2.gif" />
						</a>
					</li>
				</ul>
			</div>

			<div id="dish_2">
				<ul>
					<c:forEach items="${foodTypes}" var="foodType">
						<li style="${typeId==foodType.typeId?'background:#fddf05':''}">
							<a href="${ctx}/front/data?method=getFoodList&keyword=${keyword}&typeId=${foodType.typeId}">${foodType.typeName}</a>
						</li>
					</c:forEach>
						<%--<li>
							<a href="caidan.jsp">粤菜</a>
						</li>

						<li>
							<a href="chuancai.html">川菜</a>
						</li>
					
						<li>
							<a href="chuancai.html">湘菜</a>
						</li>
					
						<li>
							<a href="chuancai.html">东北菜</a>
						</li>--%>
					
				</ul>
			</div>
			<div id="dish_3">
				<!-- 搜索菜品表单  -->
				<form action="${ctx}/front/data" method="post">
					<table width="166px">
						<tr>
							<td>
								<input type="text" id="dish_name" name="keyword" class="select_value" value="${keyword}" />
								<input type="hidden" value="getFoodList" name="method">
							</td>
						</tr>
						<tr>
							<td><input type="submit" id="sub" value="" /></td>
						</tr>
						<tr>
							<td>
								<a href="${ctx}/front/data?method=getFoodList">
									<img src="${ctx}/front/detail/style/images/look.gif" />
								</a>
							</td>
						</tr>
					</table>
				</form>
			</div>
		</div>
	</div>
</body>
</html>
